<!DOCTYPE html>
<html>
<#assign ctx=springMacroRequestContext.contextPath />
<head>
<title>通过Sql导出代码</title>
<#include "/header.html">
</head>
<body>
<div id="autocodeapp" v-cloak>
	<div v-show="showList">
		<div class="grid-btn">
			<a class="btn btn-primary" @click="exportCode"><i class="fa fa-download"></i>&nbsp;导出</a>
			<a class="btn btn-primary btn-success" @click="viewCode"><i class="fa fa-eye"></i>&nbsp;预览</a>
			<span class="label label-info">操作提示：输入正确的Sql后点击“解析Sql”按钮，然后选择需要的表进行导出或预览</span>
		</div>
		
		<div class="row">
			<div class="col-sm-5 col-md-5 sidebar">
				<table class="table table-bordered">
					<thead>
						<tr>
							<th nowrap="nowrap">配置名称</th>
							<th nowrap="nowrap">配置内容</th>
						</tr>
					</thead>
					<tbody>
						<tr>
							<td>包路径</td>
							<td><input class="form-control" type="text" v-model="exportInfo.pakeage" value=""></td>
						</tr>
						<tr>
							<td>模板选择</td>
							<td>
								<select id="templateConfig" class="form-control" v-model="exportInfo.templateId">
									<#list templateConfigs as templateConfig>
									   	<option value="${templateConfig.id}">${templateConfig["templateName"]}</option>
									</#list>
								</select>
							</td>
						</tr>
						
						<tr>
							<td colspan="2">
								<textarea rows="10" class="form-control" v-model="q.sqlContent" placeholder="请输入正确的sql语句..."></textarea>
							</td>
						</tr>
						
						<tr>
							<td colspan="2" align="right">
								<a class="btn btn-default btn-warning" @click="analysisSql">&nbsp;解析Sql</a>
							</td>
						</tr>
					</tbody>
				</table>
			</div>
			<div class="col-sm-7 col-md-7">
				<table id="jqGrid"></table>
			</div>
		</div>
		
		
</div>
    <div style="display: none;">
		<form action="${ctx}/export/doExportFromSql.htm" method="post" id="exportForm">
			<input type="hidden" name="sqlContent" v-model="q.sqlContent" />
			<input type="hidden" name="javaPakeage" v-model="exportInfo.pakeage" />
			<input type="hidden" name="templateId" v-model="exportInfo.templateId" />
			<input type="hidden" name="tableNames" id="tableNames" />
			
		</form>
	</div>
<script src="${ctx}/js/codeExport/exportFromSql.js?_${.now?long}"></script>
</body>
</html>